'''
Created on 2011-12-28

@author: alex.ren
'''

import time
import ctypes
import screener
import win32process

memoryreader = ctypes.cdll.LoadLibrary('interface.dll')
hwnd = screener.getHandle()
hreadID, processID = win32process.GetWindowThreadProcessId(hwnd)

ADDR_X = 0x00E4CC08
ADDR_Y = 0x00E4CC04
ADDR_BLOOD = 0x05070780
ADDR_MAX_BLOOD = 0x0507077C

def getX():
    return memoryreader.readFloat(processID, ADDR_X)

def getY():
    return memoryreader.readFloat(processID, ADDR_Y)

def getBlood():
    return memoryreader.readInt(processID, ADDR_BLOOD)

def getMaxBlood():
    return memoryreader.readInt(processID, ADDR_MAX_BLOOD)

def keyUp(key):
    memoryreader.keyUp(hwnd, key)
    
def keyDown(key):
    memoryreader.keyDown(hwnd, key)
    
def pressAt(key):
    memoryreader.pressAt(hwnd, key)